package reno.market.mainmarket.common;

import org.hibernate.Session;
import org.hibernate.query.NativeQuery;
import reno.market.mainmarket.rivenmarket.entity.StringContentEO;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class StringContent {

    public static final String INGAME = "ingame";
    public static final String SELL = "sell";
    public static final String BUY = "buy";

    public final static Map<String, String> RIVENPROPMAP = new HashMap<>();                     //紫卡属性

    {
        String sql = "SELECT * FROM StringContent";
        Session session = HibernateUtils.getSession();
        NativeQuery<StringContentEO> query = session.createNativeQuery(sql, StringContentEO.class);
        List<StringContentEO> stringContentEOList = query.getResultList();
        for (StringContentEO eachEO : stringContentEOList) {
            switch (eachEO.getType()) {
                case "RIVENMODPROP":
                    RIVENPROPMAP.put(eachEO.getKey(), eachEO.getValue());
                    break;
            }
        }
        session.close();
        System.out.println("StringContent Init Finished");
    }

}

